<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@page import="com.webapp.model.Sale, com.webapp.model.AdvertisementModel, java.util.List" %>
<% 
	List myTransactions =  (List)session.getAttribute("Transactions");
	System.out.print(myTransactions);
	if(myTransactions == null)
		response.sendRedirect("Error.jsp");
%>
<!-- include moo talk header file -->
<%@ include file="MooTalkHeader.jsp" %>

		<div id="site_content_text">
			
				<h2>All Advertisements</h2>
				<table border="1"> <tr>
										<td><font size="2" face="arial" color="black">Transaction ID</font></td>
										<td><font size="2" face="arial" color="black">Date</font></td>
										<td><font size="2" face="arial" color="black">Advertisement</font></td>
										<td><font size="2" face="arial" color="black">Number of Units</font></td>
										<td><font size="2" face="arial" color="black">Account</font></td>
				</tr>
				<% if (myTransactions.size() == 0) { %>
					<p>There are no Transactions!</p>
					</table>
				<% } else {
					for(int i = 0; i < myTransactions.size(); i++) { 
						Sale theTransaction = (Sale)myTransactions.get(i);
						if(i%2 == 0) { %>
						<%
						} else { %>
						<% }%>
							<tr>
									<td><font size="2" face="arial" color="black"> <%=theTransaction.getTransactionId() %> </font></td>
									<td><font size="2" face="arial" color="black">  <%=theTransaction.getDate() %> </font></td>
									<td><font size="2" face="arial" color="black"> <%=theTransaction.getAdvertisementId() %> </font></td>
									<td><font size="2" face="arial" color="black"> <%=theTransaction.getUnits() %> </font></td>
									<td><font size="2" face="arial" color="black"> <%=theTransaction.getAccountNumber() %> </font></td>
							</tr>
						
				<% }
				} %> </table>
			<br/>
			<hr/>
			<br/>
		</div>
		
<!--  include moo talk footer file -->
<%@ include file="MooTalkFooter.jsp" %>
